#ifndef NANE_INPUTBINDINGIMPL__H
#   define  NANE_INPUTBINDINGIMPL__H

#   include "nane/InputSystem/InputSystem.h"

#   include <vector>

namespace nane
{
    class InputBindingImpl
    {
    public:
        InputBindingImpl( const InputBinding& _inputBinding, uint32 _modifiersCount, const InputBindingModifier* _modifiers );
        ~InputBindingImpl();
        
        InputBindingImpl& operator=( const InputBinding& _inputBinding );
        bool operator==( const InputBinding& _inputBinding );
        
        void OnFrameBegin();
        void OnInputEvent( EInputDevice _inputDevice, InputEvent* _event );
        float GetLastValue();
        float GetAverageValue();
        uint32 WasPressed();
        bool IsPressed();
        uint32 WasReleased();
        bool IsReleased();
        
    private:
        struct Modifier
        {
            uint32 deviceNumAxisHash;
            bool isPressed;
        };
        
        bool AllModifiersPressed_();
        
    private:
        uint32 m_deviceNumAxisHash;
        int32 m_axisValueLast;
        int32 m_axisValueAccumulated;
        uint32 m_eventsNum;
        float m_scale;
        float m_treshold;
        uint32 m_wasPressed;
        uint32 m_wasReleased;
        bool m_allModifiersPressed;
        bool m_modifiersStateOutOfDate;
        std::vector<Modifier> m_modifiers;
    };
}   // namespace nane

#endif  // NANE_INPUTBINDINGIMPL__H
